package sunwin.yois.web.common;

import java.util.List;

/**
 * Created by mt on 2015/7/30.
 * 响应ajax类
 */
public class YoisAjaxAnswer {
    private boolean isSuccess;
    private String dataType;
    private String data;
    private String exception;
    private List<String> exceptions;

    public static YoisAjaxAnswer getInstance(boolean isSuccess){
        return new YoisAjaxAnswer(isSuccess);
    }
    public static YoisAjaxAnswer getInstance(){
        return new YoisAjaxAnswer(true);
    }
    public static YoisAjaxAnswer getInstance(boolean isSuccess, String exception, List<String> exceptions){
        return new YoisAjaxAnswer(isSuccess, exception, exceptions);
    }
    public static YoisAjaxAnswer getInstance(boolean isSuccess, String exception){
        return new YoisAjaxAnswer(isSuccess, exception);
    }

    public YoisAjaxAnswer(boolean isSuccess, String exception, List<String> exceptions) {
        this.isSuccess = isSuccess;
        this.exception = exception;
        this.exceptions = exceptions;
    }
    public YoisAjaxAnswer(boolean isSuccess, String exception) {
        this.isSuccess = isSuccess;
        this.exception = exception;
    }
    public YoisAjaxAnswer(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }
    public YoisAjaxAnswer(String exception) {
        this.exception = exception;
    }
    public YoisAjaxAnswer() {
    }

    public String getDataType() {
        return dataType;
    }
    public void setDataType(String dataType) {
        this.dataType = dataType;
    }
    public String getData() {
        return data;
    }
    public void setData(String data) {
        this.data = data;
    }
    public boolean isSuccess() {
        return isSuccess;
    }
    public void setSuccess(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }
    public String getException() {
        if(this.exception == null){
            return "";
        }
        return exception;
    }
    public void setException(String exception) {
        this.exception = exception;
    }
    public List<String> getExceptions() {
        return exceptions;
    }
    public void setExceptions(List<String> exceptions) {
        this.exceptions = exceptions;
    }
}
